package com.sq.api.user;

import com.sq.api.dto.SysUserDto;
import com.sq.api.openfeignFallbackFactory.UserServiceApiFallbackFactory;
import com.sq.api.user.model.LoginUser;
import com.sq.common.web.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author Li sir
 * @Date 2024/9/29
 */

@FeignClient(name = "sq-system-server",
        contextId = "UserServiceApi",
        url = "http://localhost:8082",
//        dismiss404 = true,
        fallbackFactory = UserServiceApiFallbackFactory.class)
public interface UserServiceApi {


    @RequestMapping("/api/user/info/{username}")
    R<LoginUser> getUserInfo(@PathVariable("username") String userName);


    @RequestMapping("/api/user/exist/{username}")
    R<LoginUser> existUser(@PathVariable("username") String userName);

    @PostMapping("/api/user/saveuser")
    R<Integer> registerUser(SysUserDto sysUserDto);

}
